package com.legal.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>刷题详情记录表</p>
 * <p>记录用户每次刷题的具体答题情况</p>
 *
 * @author xiaopeng
 * @since 2025-06-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_practice_detail")
@Schema(name = "PracticeDetail", description = "用户刷题详情记录")
public class PracticeDetail implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 构造函数 - 创建一个 PracticeDetail 对象
     * @param recordNo
     * @param questionNo
     * @param userAnswer
     * @param isCorrect
     */
    public PracticeDetail(String recordNo, String questionNo, String userAnswer, Integer isCorrect) {
        this.recordNo = recordNo;
        this.questionNo = questionNo;
        this.userAnswer = userAnswer;
        this.isCorrect = isCorrect;
    }


    @Schema(description = "主键ID",
            example = "123456")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "关联的刷题记录编号",
            example = "REC001")
    private String recordNo;

    @Schema(description = "题目唯一编号",
            example = "Q1001" )
    private String questionNo;

    @Schema(description = "用户提交的答案(JSON格式)",
            example = "A,B")
    private String userAnswer;

    @Schema(description = "是否正确(1正确 0错误)",
            example = "1")
    private Integer isCorrect;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "记录创建时间",
            example = "2025-06-28")
    private LocalDateTime createTime;
}
